class Solution:
    def sortArray(self, nums: list) -> list:
        """快速排序
        """
        self.quickSort(nums, 0, len(nums) - 1)
        return nums

    def quickSort(self, array: list, left: int, right: int):
        if left < right:
            key = array[left]
            i = left
            j = right
            while i < j:
                while i < j and array[j] > key:
                    j -= 1
                if i < j:
                    array[i] = array[j]
                    i += 1
                while i < j and array[i] < key:
                    i += 1
                if i < j:
                    array[j] = array[i]
                    j -= 1
            array[i] = key
            self.quickSort(array, left, i - 1)
            self.quickSort(array, i + 1, right)
